import request from '@/utils/http'
import {
  CommentGetAllParam,
  CommentGetByIdParam,
  CommentUpdateParam,
  CommentDeleteParam,
  ShopComment,
  CommentDetail,
  Keyword,
  KeywordParam,
  KeywordSaveParam,
  KeywordUpdateParam,
  KeywordDeleteParam,
  KeywordStartParam
} from './model/commentModel'
import type { BaseResult, PageResult } from '@/types/axios'

// 评论管理相关API

// 敏感词查询
export function sensitiveGetAll() {
  return request.post<BaseResult<any>>({
    url: '/sensitive/get'
  })
}

// 添加敏感词设置
export function sensitiveAdd(data: any) {
  return request.post<BaseResult<any>>({
    url: '/sensitive/save',
    data
  })
}

// 更新敏感词设置
export function sensitiveUpdate(data: any) {
  return request.post<BaseResult<any>>({
    url: '/sensitive/update',
    data
  })
}

// 评论管理查询
export function commentSysGetall(data: CommentGetAllParam) {
  return request.post<BaseResult<PageResult<ShopComment>>>({
    url: '/comment/getAll',
    data
  })
}

// 评论详情查询
export function commentSysGetById(data: CommentGetByIdParam) {
  return request.post<BaseResult<CommentDetail>>({
    url: '/comment/getById',
    data
  })
}

// 修改评论
export function commentSysUpdate(data: CommentUpdateParam) {
  return request.post<any>({
    url: '/comment/update',
    data
  })
}

// 删除评论
export function commentSysDelete(data: CommentDeleteParam) {
  return request.post<any>({
    url: '/comment/delete',
    data
  })
}

// 允许展示评论
export function commentAllow(data: CommentGetByIdParam) {
  return request.post<any>({
    url: '/comment/allow',
    data
  })
}

// 关键词管理相关API

// 关键词查询
export function wordGetAll(data: KeywordParam) {
  return request.post<BaseResult<PageResult<Keyword>>>({
    url: '/word/getAll',
    data
  })
}

// 添加关键词
export function wordAdd(data: KeywordSaveParam) {
  return request.post<BaseResult<any>>({
    url: '/word/save',
    data
  })
}

// 修改关键词查询
export function wordGetById(data: KeywordDeleteParam) {
  return request.post<BaseResult<Keyword>>({
    url: '/word/getById',
    data
  })
}

// 修改关键词
export function wordUpdate(data: KeywordUpdateParam) {
  return request.post<BaseResult<any>>({
    url: '/word/update',
    data
  })
}

// 删除关键词
export function wordDelete(data: KeywordDeleteParam) {
  return request.post<BaseResult<any>>({
    url: '/word/delete',
    data
  })
}

// 关键词启停用
export function wordStart(data: KeywordStartParam) {
  return request.post<BaseResult<any>>({
    url: '/word/start',
    data
  })
}

// 宠圈动态评论管理
export function getAllRecommendComment(data: any) {
  return request.post<BaseResult<any>>({
    url: '/recommendUser/getAll',
    data
  })
}

export function deleteRecommendComment(commentId: string) {
  return request.del<any>({
    url: `/recommendUser/delete/report?commentId=${commentId}`
  })
}

// 更新宠圈动态评论状态
export function updateRecommendCommentStatus(data: any) {
  return request.post<BaseResult<any>>({    url: '/recommendUser/update/statue',    data  })
}
